Remove GtkWidget::draw-border
authorMatthias Clasen <mclasen@redhat.com>
Wed, 18 Aug 2010 16:46:57 +0000 (12:46 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 18 Aug 2010 16:46:57 +0000 (12:46 -0400)
This is a never-used style property that came out of some old
themeing experiments, and handling it has some performance
overhead. Bug 426924

gtk/gtkrc.c
gtk/gtkwidget.c

index 19d0f6cd87fe54550bee1e3456f3446a3606f45e..d462136ea2db9637bbd32614d3aba2bcd85bebe1 100644 (file)
@@ -903,11 +903,6 @@ _gtk_rc_init (void)
                       "  text[PRELIGHT] = \"#ffffff\"\n"
                       "}\n"
                       "\n"
-                       /* Work around clipping of accelerator underlines */
-                       "style \"gtk-default-label-style\" {\n"
-                       "  GtkWidget::draw-border = {0,0,0,1}\n"
-                       "}\n"
-                       "\n"    
                       "class \"GtkProgressBar\" style : gtk \"gtk-default-progress-bar-style\"\n"
                       "class \"GtkEntry\" style : gtk \"gtk-default-entry-style\"\n"
                       "widget \"gtk-tooltip*\" style : gtk \"gtk-default-tooltips-style\"\n"
index 62ad959f3be9f0e8d859f7dc5acc48f7d6a63519..98f17233bd3fda00f784118e04f1b52f7db9a72c 100644 (file)
@@ -360,8 +360,6 @@ static void             gtk_widget_queue_tooltip_query          (GtkWidget *widg
 static void gtk_widget_set_usize_internal (GtkWidget *widget,
                                           gint       width,
                                           gint       height);
-static void gtk_widget_get_draw_rectangle (GtkWidget    *widget,
-                                          GdkRectangle *rect);
 
 static void gtk_widget_add_events_internal (GtkWidget *widget,
                                             GdkDevice *device,
@@ -2497,21 +2495,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                                                                  FALSE,
                                                                  GTK_PARAM_READWRITE));
 
-  /**
-   * GtkWidget:draw-border:
-   *
-   * The "draw-border" style property defines the size of areas outside 
-   * the widget's allocation to draw.
-   *
-   * Since: 2.8
-   */
-  gtk_widget_class_install_style_property (klass,
-                                          g_param_spec_boxed ("draw-border",
-                                                              P_("Draw Border"),
-                                                              P_("Size of areas outside the widget's allocation to draw"),
-                                                              GTK_TYPE_BORDER,
-                                                              GTK_PARAM_READABLE));
-
   /**
    * GtkWidget:link-color:
    *
@@ -3712,57 +3695,6 @@ gtk_widget_queue_draw_area (GtkWidget *widget,
   gdk_window_invalidate_rect (widget->window, &invalid_rect, TRUE);
 }
 
-static void
-widget_add_child_draw_rectangle (GtkWidget    *widget,
-                                GdkRectangle *rect)
-{
-  GdkRectangle child_rect;
-  
-  if (!gtk_widget_get_mapped (widget) ||
-      widget->window != widget->parent->window)
-    return;
-
-  gtk_widget_get_draw_rectangle (widget, &child_rect);
-  gdk_rectangle_union (rect, &child_rect, rect);
-}
-
-static void
-gtk_widget_get_draw_rectangle (GtkWidget    *widget,
-                              GdkRectangle *rect)
-{
-  if (!gtk_widget_get_has_window (widget))
-    {
-      GtkBorder *draw_border = NULL;
-
-      *rect = widget->allocation;
-
-      gtk_widget_style_get (widget,
-                           "draw-border", &draw_border,
-                           NULL);
-      if (draw_border)
-       {
-         rect->x -= draw_border->left;
-         rect->y -= draw_border->top;
-         rect->width += draw_border->left + draw_border->right;
-         rect->height += draw_border->top + draw_border->bottom;
-
-          gtk_border_free (draw_border);
-       }
-
-      if (GTK_IS_CONTAINER (widget))
-       gtk_container_forall (GTK_CONTAINER (widget),
-                             (GtkCallback)widget_add_child_draw_rectangle,
-                             rect);
-    }
-  else
-    {
-      rect->x = 0;
-      rect->y = 0;
-      rect->width = widget->allocation.width;
-      rect->height = widget->allocation.height;
-    }
-}
-
 /**
  * gtk_widget_queue_draw:
  * @widget: a #GtkWidget
@@ -3777,7 +3709,7 @@ gtk_widget_queue_draw (GtkWidget *widget)
   
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  gtk_widget_get_draw_rectangle (widget, &rect);
+  gtk_widget_get_allocation (widget, &rect);
 
   gtk_widget_queue_draw_area (widget,
                              rect.x, rect.y,
@@ -3938,26 +3870,12 @@ gtk_widget_queue_shallow_draw (GtkWidget *widget)
 {
   GdkRectangle rect;
   cairo_region_t *region;
-  
+
   if (!gtk_widget_get_realized (widget))
     return;
 
-  gtk_widget_get_draw_rectangle (widget, &rect);
+  gtk_widget_get_allocation (widget, &rect);
 
-  /* get_draw_rectangle() gives us window coordinates, we
-   * need to convert to the coordinates that widget->allocation
-   * is in.
-   */
-  if (gtk_widget_get_has_window (widget) && widget->parent)
-    {
-      int wx, wy;
-      
-      gdk_window_get_position (widget->window, &wx, &wy);
-      
-      rect.x += wx;
-      rect.y += wy;
-    }
-  
   region = cairo_region_create_rectangle (&rect);
   gtk_widget_invalidate_widget_windows (widget, region);
   cairo_region_destroy (region);
@@ -5207,7 +5125,7 @@ gtk_widget_region_intersect (GtkWidget       *widget,
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
   g_return_val_if_fail (region != NULL, NULL);
 
-  gtk_widget_get_draw_rectangle (widget, &rect);
+  gtk_widget_get_allocation (widget, &rect);
   
   dest = cairo_region_create_rectangle (&rect);